<!-- 纵向布局 -->
<template>
  <el-container class="layout">
    <el-aside>
      <div class="aside-box" :style="{ width: isCollapse ? '65px' : '210px' }">
        <div class="logo flx-center">
          <!-- <img class="logo-img" src="@/assets/images/beita_favicon.ico" alt="logo" /> -->
          <img class="logo-img" src="/fsey_favicon.ico" alt="logo" />
          <span v-show="!isCollapse" class="logo-text">{{ title }}</span>
          <!-- <div :style="{ width: '80%' }">
            <img class="logo-text" :style="{ width: '100%' }" src="@/assets/images/shuiwu.png" alt="" />
          </div> -->
        </div>
        <el-scrollbar>
          <el-menu
            :router="false"
            :default-active="activeMenu"
            :collapse="isCollapse"
            :unique-opened="accordion"
            :collapse-transition="false"
          >
            <SubMenu :menu-list="menuList" />
          </el-menu>
        </el-scrollbar>
      </div>
    </el-aside>
    <el-container>
      <el-header>
        <div style="display: flex; align-items: center; justify-content: space-between; width: 100%">
          <ToolBarLeft />
          <div style="position: relative; display: flex; flex: 1; align-items: center; justify-content: flex-end">
            <el-button icon="menu" v-if="route.path == '/home/index'" @click="indexSort">首页布局</el-button>
            <ToolBarRight />
          </div>
        </div>
      </el-header>
      <Main />
    </el-container>
  </el-container>
</template>

<script setup lang="ts" name="layoutVertical">
import { computed } from "vue";
import { useRoute } from "vue-router";
import { useAuthStore } from "@/stores/modules/auth";
import { useGlobalStore } from "@/stores/modules/global";
import Main from "@/layouts/components/Main/index.vue";
import ToolBarLeft from "@/layouts/components/Header/ToolBarLeft.vue";
import ToolBarRight from "@/layouts/components/Header/ToolBarRight.vue";
import SubMenu from "@/layouts/components/Menu/SubMenu.vue";

const globalStore = useGlobalStore();

const sort = computed(() => {
  return globalStore.sort;
});

// 控制是否能拖拽
const indexSort = () => {
  globalStore.setSort(!sort.value);
};

const title = import.meta.env.VITE_GLOB_APP_TITLE;

const route = useRoute();
const authStore = useAuthStore();
const accordion = computed(() => globalStore.accordion);
const isCollapse = computed(() => globalStore.isCollapse);
const menuList = computed(() => authStore.showMenuListGet);
const activeMenu = computed(() => (route.meta.activeMenu ? route.meta.activeMenu : route.path) as string);
</script>

<style scoped lang="scss">
@import "./index";
</style>
